<template>
  <div>
    <el-table
        :data="list" border style="width: 100%" >
      <el-table-column prop="roomName" label="教室" width="180">
      </el-table-column>
      <el-table-column prop="beginTime" label="开始时间">
      </el-table-column>
      <el-table-column prop="endTime" label="截止时间">
      </el-table-column>
      <el-table-column label="状态" #default="scope">
        <el-button v-if="scope.row.state === 0" disabled type="info">预约中</el-button>
        <el-button v-else-if="scope.row.state === 1" type="info" disabled>已通过</el-button>
        <el-button v-else-if="scope.row.state === 2" type="info" disabled>已拒绝</el-button>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {IP} from "@/config";
import axios from "axios";
export default {
  name: "MyAppoint",
  data(){
    return{
      info:{},
      list:[],
    }
  },
  methods:{

  },
  mounted() {
    this.info = JSON.parse(sessionStorage.getItem("info"))
    let url = IP + "appointment/getMyAppoint"
    axios.post(url,this.info).then(res=>{
      console.log(res)
      this.list = res.data.data.appointList
      let roomNameList = res.data.data.roomName
      this.list.forEach((item,index)=>{
        this.list.splice(index,1,{...item,'roomName':roomNameList[index]})
      })
    }).catch(error=>{
      console.log(error)
    })
  }
}
</script>

<style scoped>

</style>